import { Bank } from "src/modules/bank/bank.entity";
import { Client } from "src/modules/client/client.entity";
import { Delivery } from "src/modules/delivery/delivery.entity";
import { Log } from "src/modules/log/log.entity";
import { Order } from "src/modules/order/order.entity";
import { Quality } from "src/modules/quality/quality.entity";
import { Statistic } from "src/modules/statistics/statistic.entity";
import { Type } from "src/modules/type/type.entity";
import { User } from "src/modules/user/user.entity";
import {
  Column,
  CreateDateColumn,
  Entity,
  OneToMany,
  PrimaryGeneratedColumn,
} from "typeorm";

@Entity()
export class Company {
  @PrimaryGeneratedColumn("uuid")
  id: string;

  @Column({ nullable: false, unique: true })
  name: string;

  @Column({ default: "" })
  address: string;

  @Column({ default: "" })
  contact: string;

  @Column({ default: "" })
  fax: string;

  @Column({ default: "" })
  introduction: string;

  @CreateDateColumn()
  date: Date;

  @OneToMany(() => User, (user) => user.company)
  users: User[];

  @OneToMany(() => Bank, (bank) => bank.company)
  banks: Bank[];

  @OneToMany(() => Client, (client) => client.company)
  clients: Client[];

  @OneToMany(() => Type, (type) => type.company)
  types: Type[];

  @OneToMany(() => Quality, (quality) => quality.company)
  qualities: Quality[];

  @OneToMany(() => Order, (order) => order.company)
  orders: Order[];

  @OneToMany(() => Delivery, (delivery) => delivery.company)
  deliveries: Delivery[];

  @OneToMany(() => Statistic, (statistic) => statistic.company)
  statistics: Statistic[];

  @OneToMany(() => Log, (log) => log.company)
  logs: Log[];
}
